using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
/// <summary>
/// Summary description for DBAccess
/// </summary>
public class DBAccess
{
    protected string strConn;
    protected SqlConnection conn;
    string message;
    public string Message
    {
        get { return message; }
    }
	public DBAccess()
	{
        try
        {
            strConn = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
            conn = new SqlConnection(strConn);
        }
        catch (Exception ex)
        {
            message = ex.Message;
        }
    }
    #region methods
    public bool Connect()
    {
        try
        {
            conn.Open();
            return true;
        }
        catch (Exception ex) { message = ex.Message; }
        return false;
    }
    public void Disconnect()
    {
        try
        {
            conn.Close();
        }
        catch (Exception ex) { message = ex.Message; }
    }
    #endregion
}
